package com.laterem.rtc.config;

import com.laterem.rtc.http.HttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;

/**
 * @creator: alan wu
 * @dateTime: 2023/5/27 18:43
 * @desc:
 */
@Configuration
public class HttpClientConfig {

    @Bean
    HttpClient httpClient() {
        WebClient client = WebClient.builder().baseUrl("https://api.jisuapi.com").build();
        HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(client)).build();
        return factory.createClient(HttpClient.class);
    }
}
